home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / quicktime / quicktime for java / zoo tutorial / module 9- full screen mode / source / mappane.java < prev    next >
Encoding:
Java Source  |  2000-06-23  |  5.5 KB  |  143 lines

  1. import java.awt.*;
  2. import java.awt.event.*;
  3. import java.io.*;
  4. import java.util.Hashtable;
  5.  
  6. import quicktime.*;
  7. import quicktime.qd.*;
  8. import quicktime.std.*;
  9. import quicktime.io.*;
  10. import quicktime.sound.*;
  11. import quicktime.std.image.*;
  12. import quicktime.std.music.*;
  13. import quicktime.std.movies.*;
  14. import quicktime.util.*;
  15. import quicktime.app.display.*;
  16. import quicktime.app.image.*;
  17. import quicktime.app.anim.*;
  18. import quicktime.app.actions.*;
  19.  
  20. import quicktime.app.audio.*;
  21.  
  22. import quicktime.app.event.QTActionEvent;  
  23. import quicktime.app.event.QTActionListener;
  24. import quicktime.app.event.QTMouseTargetController; 
  25.  
  26. import quicktime.app.QTFactory;
  27. import quicktime.std.movies.media.DataRef;
  28. import quicktime.app.players.QTPlayer;
  29.  
  30. /**
  31.  * QTZoo Module 8 - Using QuickTime Transitions
  32.  * This sample requires QuickTime for Java 4.1
  33.  *
  34.  * The Map pane that contains the main map interface
  35.  *
  36.  * @author Levi Brown
  37.  * @author Michael Hopkins
  38.  * @author Apple Computer, Inc.
  39.  * @version 8.0 10/21/1999
  40.  * Copyright:     © Copyright 1999 Apple Computer, Inc. All rights reserved.
  41.  *    
  42.  * Disclaimer:    IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
  43.  *                ("Apple") in consideration of your agreement to the following terms, and your
  44.  *                use, installation, modification or redistribution of this Apple software
  45.  *                constitutes acceptance of these terms.  If you do not agree with these terms,
  46.  *                please do not use, install, modify or redistribute this Apple software.
  47.  *
  48.  *                In consideration of your agreement to abide by the following terms, and subject
  49.  *                to these terms, Apple grants you a personal, non-exclusive license, under Apple’s
  50.  *                copyrights in this original Apple software (the "Apple Software"), to use,
  51.  *                reproduce, modify and redistribute the Apple Software, with or without
  52.  *                modifications, in source and/or binary forms; provided that if you redistribute
  53.  *                the Apple Software in its entirety and without modifications, you must retain
  54.  *                this notice and the following text and disclaimers in all such redistributions of
  55.  *                the Apple Software.  Neither the name, trademarks, service marks or logos of
  56.  *                Apple Computer, Inc. may be used to endorse or promote products derived from the
  57.  *                Apple Software without specific prior written permission from Apple.  Except as
  58.  *                expressly stated in this notice, no other rights or licenses, express or implied,
  59.  *                are granted by Apple herein, including but not limited to any patent rights that
  60.  *                may be infringed by your derivative works or by other works in which the Apple
  61.  *                Software may be incorporated.
  62.  *
  63.  *                The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
  64.  *                WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
  65.  *                WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  66.  *                PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
  67.  *                COMBINATION WITH YOUR PRODUCTS.
  68.  *
  69.  *                IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
  70.  *                CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  71.  *                GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  72.  *                ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
  73.  *                OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
  74.  *                (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
  75.  *                ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  76.  * 
  77.  * 
  78.  */
  79. public class MapPane extends ZooPane
  80. {
  81.     public MapPane( )
  82.     {
  83.         try
  84.         {    
  85.             QDRect size = new QDRect(MainFrame.WIDTH, MainFrame.HEIGHT);
  86.             QDGraphics gw = new QDGraphics (size);
  87.             compositor = new Compositor (gw, QDColor.white, 20, 1);
  88.             
  89.             QTFile waterPict = new QTFile (QTFactory.findAbsolutePath ("data/map/water.pict"));
  90.             GraphicsImporterDrawer waterDrawer = new GraphicsImporterDrawer(waterPict);
  91.             waterDrawer.setDisplayBounds (size);
  92.             ImagePresenter water = ImagePresenter.fromGraphicsImporterDrawer(waterDrawer);
  93.             compositor.addMember(water, 6);
  94.                         
  95.             QTFile                 islandFile = new QTFile( QTFactory.findAbsolutePath( "data/map/island.pict" ));
  96.             ImagePresenter         islandPresenter = ImagePresenter.fromFile( islandFile );
  97.             ImageDataSequence     islandDS = new ImageDataSequence (islandPresenter.getDescription());
  98.             
  99.             islandDS.addMember( islandPresenter.getImage() );
  100.             
  101.             if ((QTSession.isCurrentOS(QTSession.kWin32) && QTSession.getQTMajorVersion() == 3) == false)    //doesn't work on QT3.0.2 on Win
  102.                 islandDS = ImageUtil.makeTransparent ( islandDS, QDColor.white );
  103.             
  104.             Matrix theMatrix = new Matrix();
  105.             theMatrix.translate( (float) 10, (float) 5 );
  106.             TwoDSprite island = new TwoDSprite( islandDS, theMatrix, true, 2 );
  107.             
  108.             compositor.addMember(island, 4);            
  109.             
  110.             ctr = new QTMouseTargetController( false );
  111.             ctr.addQTMouseListener( new PaneMouseListener( QDColor.lightGray, QDColor.white, QDColor.darkGray ));
  112.             
  113.             compositor.addController (ctr);
  114.             
  115.             ctr.addMember( island );
  116.             
  117.             TwoDSprite currentSprite;
  118.             areas = new Hashtable(6);
  119.             
  120.         }
  121.         catch (Exception e)
  122.         {
  123.             e.printStackTrace();
  124.         }
  125.     }
  126.  
  127.     /**
  128.      * Called to do any setup after being set as the client of the QTCanvas.
  129.      * May be used to start effects running, movies playing, etc.
  130.      */
  131.     public void start()
  132.     {
  133.     }
  134.  
  135.     /**
  136.      * Called to do clean up after being removed as the client of the QTCanvas.
  137.      * Should be used to stop effects running, movies playing, etc.
  138.      */
  139.     public void stop()
  140.     {
  141.     }
  142. }
  143.